<template>
  <!-- 简历记录 -->
  <view class="box" @click="external">
    <view class="tou top" :style="'padding-top:' + statusBarHeight1 + 'px'">
      <image
        @click.stop="fanhui"
        class="image1"
        src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png"
      />
      <!-- #ifndef MP-WEIXIN -->
      简历记录
      <!-- #endif -->
      <!-- #ifdef MP-WEIXIN -->
      <text @click="fanhui" style="margin-left: 75rpx">简历记录</text>
      <!-- #endif -->
    </view>
    <view class="tit_list">
      <scroll-view
        class="scroll-view"
        :scroll-y="modalName == '' || modalName == null"
        @scrolltolower="down"
        :scroll-top="scrollTop1"
        refresher-background="#f5f5f5"
      >
        <view
          class="resume"
          v-for="(item, index) in Recommend"
          :key="item.id"
          @click="details(item)"
        >
          <view class="title" :style="'color:' + (item.active ? '#adadad' : '#333333')">{{
            item.resumeTitle
          }}</view>
          <view class="occupation">
            <!-- <span>{{item.intendedPosition}}</span> -->
            <span
              class="occupation_text"
              :key="index1"
              v-for="(item1, index1) in item.intendedPosition.split(',')"
              >{{ item1 }}</span
            >
          </view>
          <view class="hands-on">
            <span>{{ item.experienceYears }}工作经验·</span>
            <span>{{ item.highestEducation.split(' ')[0] }}</span>
          </view>
          <view class="individual">
            <view class="individual_left">
              <view class="name">
                {{ item.userInformation.nikeName ? item.userInformation.nikeName : '未命名用户' }}
              </view>
              <text
                class="vip-rank"
                :style="{
                  color: $member.colors()[userInfo.memberLevel - 1].wordColor,
                  backgroundColor: $member.colors()[userInfo.memberLevel - 1].bgColor,
                  borderColor: $member.colors()[userInfo.memberLevel - 1].lineColor,
                }"
              >
                {{ $member.colors()[userInfo.memberLevel - 1].level }}
              </text>
            </view>
            <view v-if="item.latitude" class="individual_right"> {{ item.distance }}km </view>
          </view>
        </view>
        <view v-if="Recommend.length == 0" class="none">
          <image src="https://pic.bangbangtongcheng.com/static/none.png" mode="widthFix" />
          <view>没有更多数据了</view>
        </view>
        <view class="down" v-show="Recommend.length != 0 && !downStatus">没有更多了</view>
      </scroll-view>
    </view>
    <view v-if="scrollTop > 0" class="hui" @click.stop="totop">
      <image src="https://pic.bangbangtongcheng.com/static/top.png" />返回顶部
    </view>
    <uniBall></uniBall>
  </view>
</template>

<script>
  import permision from '@/js_sdk/wa-permission/permission.js'
  import { mapGetters } from 'vuex'
  //#ifdef H5
  import wxshare from '../../utils/index.js'
  //#endif
  export default {
    data() {
      return {
        Recommend: [],
        imgUrl: this.$imgSrc,
        scrollTop: '0',
        scrollTop1: '0',
        trigger: false,
        downStatus: true,
        upStatus: true,
        CustomBar1: '',
        userInfo: uni.getStorageSync('Pduser'),
        viewHight: '',
        modalName: '',
        data: {
          pageNo: 1,
          pageSize: 10,
          latitude: '',
          longitude: '',
        },
        userId: '',
        id: '',
        status: '',
      }
    },
    computed: {
      ...mapGetters(['statusBarHeight1', 'userinfo']),
    },
    filters: {
      nums(val) {
        return val.toFixed(2)
      },
    },
    async onLoad(option) {
      if (uni.getStorageSync('locationState') == 1) {
        await this.getLocation()
      }
      if (option.userId) {
        this.userId = option.userId
        this.id = option.id
        this.status = option.status
      }
      this.CustomBar1 = this.CustomBar
      /* #ifdef H5 */
      this.jinzhi()
      /* #endif */
    },
    onPageScroll: function (Object) {
      this.scrollTop = Object.scrollTop
    },
    async onPullDownRefresh() {
      this.Recommend = []
      this.data.pageNo = 1
      this.downStatus = true
      if (this.upStatus) {
        this.trigger = true
        await this.getRecommend()
      }
    },
    methods: {
      // 点击会员
      goMyLevel() {
        uni.navigateTo({
          url: '/pages_my/bangClub',
        })
      },
      jinzhi() {
        let _this = this
        let param = window.location.href.split('#')[0]
        uni.request({
          method: 'post',
          data: {
            url: param,
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded',
          },
          url: 'https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do',
          success(re) {
            _this.jinzhifx(re.data)
          },
        })
      },
      jinzhifx(data) {
        wxshare.config({
          debug: false, //是否打开调试
          appId: data.appId, // 公众号的唯一标识
          timestamp: data.timestamp, // 生成签名的时间戳
          nonceStr: data.nonce, // ，生成签名的随机串
          signature: data.signature, // 签名
          jsApiList: ['hideMenuItems'],
        })
        // 禁止分享
        wxshare.hideMenuItems({
          // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
          menuList: [
            'menuItem:share:appMessage',
            'menuItem:share:timeline',
            'menuItem:share:timeline',
            'menuItem:share:qq',
            'menuItem:favorite',
            'menuItem:share:QZone',
            'menuItem:openWithSafari',
          ],
        })
      },
      totop() {
        this.scrollTop1 = this.oldScrollTop
        this.$nextTick(() => {
          this.scrollTop1 = 0
        })
      },
      details(item) {
        // 有简历
        uni.navigateTo({
          url:
            '/pages_recruitMoney/submitResume/deliver?userId=' +
            this.userId +
            '&index=2&status=1&id=' +
            this.id +
            '&ids=' +
            item.id,
        })
      },
      down() {
        if (this.downStatus) {
          this.data.pageNo++
          this.getRecommend()
        }
      },
      async up() {
        this.Recommend = []
        this.data.pageNo = 1
        this.downStatus = true
        if (this.upStatus) {
          this.trigger = true
          await this.getRecommend()
        }
      },
      getRecommend() {
        this.upStatus = false
        this.data.userId = this.userinfo.id
        this.$myRequest
          .get('/api/mobile/personnelOwner/getDeliveryRecordTabulation', this.data)
          .then((res) => {
            uni.hideLoading()
            if (!res.deliveryRecordTabulation.length) {
              this.downStatus = false
            }
            this.upStatus = true
            this.trigger = false
            res.deliveryRecordTabulation.pageList.forEach((v) => {
              v.active = false
            })
            this.Recommend = this.Recommend.concat(res.deliveryRecordTabulation.pageList)
            uni.stopPullDownRefresh()
          })
      },
      fanhui() {
        uni.navigateBack({
          delta: 1,
        })
      },
      async getLocation() {
        this.getLocation1()
      },
      getLocation1() {
        uni.showLoading({
          title: '加载中',
          mask: true,
        })
        let _this = this
        uni.getLocation({
          type: 'gcj02',
          highAccuracyExpireTime: '3000',
          success(res) {
            _this.data.latitude = res.latitude
            _this.data.longitude = res.longitude
            _this.getRecommend()
          },
          fail:(res) => {
            console.log(res, '经纬度没有授权');
            this.$SHOWMODAL_TO_SETTINGS();
            uni.setStorageSync('locationState', 0)
            if (uni.getStorageSync('locationState') == 0) {
              // uni.showModal({
              //   title: '提示',
              //   content: '您已关闭位置权限或获取位置信息失败',
              //   success: function (res) {
              //     if (res.confirm) {
              //       // plus.runtime.openURL("app-settings:");
              //       if (plus.os.name === 'iOS') {
              //         plus.runtime.openURL('app-settings://')
              //       } else {
              //         var Intent = plus.android.importClass('android.content.Intent')
              //         var Settings = plus.android.importClass('android.provider.Settings')
              //         var Uri = plus.android.importClass('android.net.Uri')
              //         var mainActivity = plus.android.runtimeMainActivity()
              //         var intent = new Intent()
              //         intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
              //         var uri = Uri.fromParts('package', mainActivity.getPackageName(), null)
              //         intent.setData(uri)
              //         mainActivity.startActivity(intent)
              //       }
              //     } else if (res.cancel) {
              //       console.log('用户点击取消')
              //     }
              //   },
              // })
              return false
            }
          },
        })
      },
    },
  }
</script>

<style lang="less" scoped>
  .tittit {
    position: fixed;
    top: 0;
    right: 0;
    background-color: #f8f8f8;
    z-index: 9999;
    max-width: 100%;
    width: 600rpx;
    transition-duration: 0.3s;
    transform: translateX(100%);

    text-align: center;
    line-height: 80rpx;
    font-size: 30rpx;
    border-bottom: 2rpx solid #cccccc;

    view {
      position: absolute;
      top: 0rpx;
      left: 20rpx;
      color: #999999;
      font-size: 54rpx;
      font-weight: 100;
    }
  }

  .show .tittit {
    transform: translateX(0%);
  }

  .selector {
    display: flex;
    align-items: center;
    .selects {
      width: 140rpx;
    }
    .selector_item {
      width: 160rpx;
      height: 60rpx;
      background-color: #ffffff;
      border-radius: 8rpx;
      border: 1px solid #999999;
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      font-size: 26rpx;
      font-weight: 500;
      color: #333333;

      .image {
        width: 22rpx;
        height: 22rpx;
      }
    }
  }

  .xbRadio {
    display: flex;
    align-items: center;

    .radio {
      width: 130rpx;
      display: flex;
      align-items: center;
      margin-right: 0;

      .radio_item {
        width: 36rpx;
        height: 36rpx;
        border: 1px solid #c9c9c9;
        border-radius: 36rpx;
        margin-right: 14rpx;
      }

      span {
        font-size: 28rpx;
        font-weight: 500;
        color: #333333;
      }

      .radioxz {
        border: 1px solid #64b6a8;
        position: relative;
      }

      .radioxz::before {
        content: '';
        width: 24rpx;
        height: 24rpx;
        border-radius: 24rpx;
        background-color: #64b6a8;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }

  .cu-list {
    height: 100%;
    padding-bottom: 98rpx;
    background-color: #fff;

    .leibie {
      margin-top: 40rpx;
      font-size: 28rpx;
      margin-left: 40rpx;
      margin-right: 20rpx;

      .select {
        width: 224rpx;
        margin-left: 20rpx;
      }

      .timeInterval {
        display: flex;
        align-items: center;
      }

      .salaryRange {
        display: flex;
        align-items: center;

        .inputs {
          width: 160rpx;
          display: flex;
          align-items: center;
          font-size: 28rpx;
          font-weight: 500;
          color: #333333;

          .input {
            font-size: 24rpx;
            height: 58rpx;
            border-bottom: 1px solid #e0e0e0;
            margin-right: 10rpx;
          }
        }

        .span {
          margin: 0 10rpx;
        }

        .qued {
          width: 120rpx;
          height: 58rpx;
          background-color: #64b6a8;
          border-radius: 4rpx;
          font-size: 28rpx;
          font-weight: 400;
          color: #ffffff;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-left: 20rpx;
        }
      }

      .list {
        width: 100%;
        margin-top: 24rpx;
        display: flex;
        align-items: center;
        flex-wrap: wrap;

        .li {
          min-width: 90rpx;
          display: flex;
          align-items: center;
          justify-content: center;
          padding: 10rpx 20rpx;
          background: #f2f2f2;
          border-radius: 30rpx;
          margin-right: 24rpx;
          margin-bottom: 24rpx;
        }

        .xuan {
          background: #64b6a8;
          color: #fff;
        }
      }
    }

    .position {
      margin-top: 40rpx;
      font-size: 28rpx;
      margin-left: 40rpx;
      margin-right: 20rpx;

      .position_top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16rpx;

        .title {
          font-weight: 400;
        }

        .image {
          width: 40rpx;
          height: 40rpx;
        }
      }

      .list {
        display: flex;
        align-items: center;
        flex-wrap: wrap;

        .lable {
          font-size: 26rpx;
          font-weight: 400;
          color: #64b6a8;
          padding: 6rpx 20rpx;
          border: 1px solid #64b6a8;
          position: relative;
          border-radius: 6rpx;
          margin-right: 20rpx;
          margin-right: 14rpx;

          .close {
            width: 20rpx;
            height: 20rpx;
            position: absolute;
            top: 0;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;

            .image {
              width: 18rpx;
              height: 18rpx;
            }
          }
        }
      }
    }
  }

  .zbc {
    position: fixed;
    width: 100%;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 99999;
  }

  .box {
    width: 100%;
    min-height: 100vh;
    background-color: #fff;
  }

  .tou {
    position: relative;
    width: 100%;
    text-align: center;
    line-height: 88rpx;
    font-size: 36rpx;
    color: #fff;
    background-color: #64b6a8;
    /* #ifdef MP-WEIXIN */
    text-align: left;
    display: flex;
    align-items: center;

    /* #endif */
    .image1 {
      position: absolute;
      width: 32rpx;
      height: 32rpx;
      left: 30rpx;
    }

    .image2 {
      position: absolute;
      width: 56rpx;
      height: 56rpx;
      // top: 28rpx;
      /* #ifdef MP-WEIXIN */
      position: initial;
      margin-left: auto;
      margin-right: 200rpx;
      /* #endif */
      bottom: 16rpx !important;
      right: 30rpx;
      // #ifdef APP
      // top: 50%;
      // #endif
    }
  }

  .tit_list {
    margin-left: 30rpx;
    margin-right: 30rpx;
    width: 690rpx;

    .resume {
      width: 100%;
      padding-bottom: 30rpx;
      margin-bottom: 30rpx;
      border-bottom: 1px solid #e0e0e0;

      .title {
        font-size: 28rpx;
        font-weight: 550;
        color: #333333;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2; //想要的行数
        -webkit-box-orient: vertical;
        margin-bottom: 16rpx;
      }

      .occupation {
        display: flex;
        align-items: center;
        margin-bottom: 16rpx;

        span {
          font-size: 24rpx;
          font-weight: 400;
          color: #333333;
          margin-right: 16rpx;
        }

        span:nth-last-child(1) {
          margin-right: 0;
        }
      }

      .hands-on {
        display: flex;
        align-items: center;
        margin-bottom: 16rpx;

        span {
          font-size: 24rpx;
          font-weight: 400;
          color: #888888;
        }
      }

      .individual {
        display: flex;
        align-items: center;
        justify-content: space-between;

        .individual_left {
          display: flex;
          align-items: center;

          .name {
            font-size: 24rpx;
            font-weight: 400;
            color: #333333;
            margin-right: 10rpx;
          }

          .vip-rank {
            padding: 3rpx 10rpx;
            margin: 0 18rpx 0 0;
            background: #f6f0ff;
            border-radius: 6rpx 6rpx 6rpx 6rpx;
            opacity: 1;
            border: 2rpx solid #bd90d9;
            font-size: 24rpx;
            font-weight: 500;
            color: #bd90d9;
          }
        }

        .individual_right {
          font-size: 24rpx;
          font-weight: 400;
          color: #888888;
        }
      }
    }
  }

  .hui {
    position: fixed;
    right: 30rpx;
    bottom: 154rpx;
    display: flex;
    align-items: center;
    padding: 10rpx 20rpx;
    background-color: #fff;
    border-radius: 34rpx;
    font-size: 26rpx;
    box-shadow: 0px 0px 36rpx rgba(0, 0, 0, 0.16);

    image {
      width: 46rpx;
      height: 46rpx;
      margin-right: 18rpx;
    }
  }

  .cu-dialog {
    max-width: 100%;
    width: 600rpx;
  }

  .basis-lg {
    flex-basis: 600rpx;
    overflow: auto;
  }

  .di {
    position: fixed;
    width: 100%;
    bottom: 0rpx;
    left: 75rpx;

    .div {
      display: inline-block;
      width: 300rpx;
      height: 50px;
      text-align: center;
      line-height: 98rpx;
      font-size: 30rpx;
    }

    .l {
      background: #e0e0e0;
    }

    .r {
      background: #64b6a8;
      color: #fff;
    }
  }

  .scroll-view {
    height: calc(100vh - var(--status-bar-height) - 5px - 88rpx - 120rpx);
  }

  .down {
    height: 60rpx;
    line-height: 60rpx;
    text-align: center;
  }

  .none {
    text-align: center;

    image {
      width: 430rpx;
      margin-bottom: 16rpx;
    }

    view {
      height: 40rpx;
      line-height: 40rpx;
      color: #666;
    }
  }
</style>
